package ao

import (
	"context"
	pb "gitee.com/micro-services/protocol/tag/server"
	"micro.tag.server/impl"
)

type Tag struct{}

func (t *Tag) CreateHotelTag(ctx context.Context, r *pb.CreateHotelTagReq, w *pb.CreateHotelTagRsp) error {
	rsp, err := impl.CreateHotelTag(ctx, r)
	if err != nil {
		return err
	}

	w.Msg = rsp.Msg
	w.RetCode = rsp.RetCode
	return nil
}

func (t *Tag) DeleteHotelTag(ctx context.Context, r *pb.DeleteHotelTagReq, w *pb.DeleteHotelTagRsp) error {
	rsp, err := impl.DeleteHotelTag(ctx, r)
	if err != nil {
		return err
	}

	w.Msg = rsp.Msg
	w.RetCode = rsp.RetCode
	return nil
}

func (t *Tag) HotelTags(ctx context.Context, r *pb.HotelTagsReq, w *pb.HotelTagsRsp) error {
	infos, err := impl.HotelTags(ctx, r)
	if err != nil {
		return err
	}

	w.Tag = infos
	return nil
}

func (t *Tag) CreateRoomTag(ctx context.Context, r *pb.CreateRoomTagReq, w *pb.CreateRoomTagRsp) error {
	rsp, err := impl.CreateRoomTag(ctx, r)
	if err != nil {
		return err
	}

	w.Msg = rsp.Msg
	w.RetCode = rsp.RetCode
	return nil
}

func (t *Tag) DeleteRoomTag(ctx context.Context, r *pb.DeleteRoomTagReq, w *pb.DeleteRoomTagRsp) error {
	rsp, err := impl.DeleteRoomTag(ctx, r)
	if err != nil {
		return err
	}

	w.Msg = rsp.Msg
	w.RetCode = rsp.RetCode
	return nil
}

func (t *Tag) RoomTags(ctx context.Context, r *pb.RoomTagsReq, w *pb.RoomTagsRsp) error {
	infos, err := impl.RoomTags(ctx, r)
	if err != nil {
		return err
	}

	w.Tag = infos
	return nil
}
